package com.myk.game.lib;

/**
 * 测试代码执行时间的工具(目前不支持并发环境)
 */
public class TimeTestHelper {

    private static long startTimeMillis;
    private static long lastTimeMillis;

    public static void dot(String name) {
        long nowTimeMillis = System.currentTimeMillis();
        if (startTimeMillis == 0) {
            System.out.println("开始计时");
            startTimeMillis = nowTimeMillis;
        }
        else {
            System.out.print(name + "距离上次" + (nowTimeMillis - lastTimeMillis) + "毫秒，");
            System.out.println("距离最初" + (nowTimeMillis - startTimeMillis) + "毫秒");
        }
        lastTimeMillis = nowTimeMillis;
    }
}
